package com.user.controller;

import com.user.dao.restaurant.CreatRestaurant;
import com.user.dao.restaurant.QueryMonthSales;
import com.user.dao.restaurant.QueryPageRestaurant;
import com.user.service.RestaurantService;
import com.user.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author : Yu
 * @Date 2024/2/20 11:29
 */

@RestController
@RequestMapping("/restaurant")
public class RestaurantController {

    @Resource
    private RestaurantService restaurantService;

    /**
     * 获取餐厅列表
     *
     * @param queryPageRestaurant 查询条件
     * @return 餐厅列表
     */
    @PostMapping("/getRestaurantList")
    public R getRestaurantList(@RequestBody QueryPageRestaurant queryPageRestaurant) {
        return restaurantService.getRestaurantList(queryPageRestaurant);
    }

    @PostMapping("/getRestaurantMonthSales")
    public R getRestaurantMonthSales(@RequestBody QueryMonthSales MonthSales) {
        return restaurantService.getRestaurantMonthSales(MonthSales);
    }

    @GetMapping("/getRestaurantSales")
    public R getRestaurantSales(@RequestParam Integer restaurantId) {
        return restaurantService.getRestaurantMonthlySales(restaurantId);
    }

    @PostMapping("/createRestaurant")
    public R createRestaurant(@RequestBody CreatRestaurant creatRestaurant) {
        return restaurantService.createRestaurant(creatRestaurant);
    }

    @GetMapping("/getAllRestaurant")
    public R getAllRestaurant() {
        return restaurantService.getAllRestaurant();
    }

    @GetMapping("/updateStatus")
    public R updateStatus(@RequestParam Integer restaurantId) {
        return restaurantService.updateStatus(restaurantId);
    }

    @PostMapping("/getRestaurantsList")
    public R getRestaurantsList(@RequestBody QueryPageRestaurant queryPageRestaurant) {
        return restaurantService.getRestaurantsList(queryPageRestaurant);
    }

    @GetMapping("/getAfterSales")
    public R getAfterSales(@RequestParam Integer dishId) {
        return restaurantService.getAfterSales(dishId);
    }

    @GetMapping("/recommendRestaurants")
    public R recommendRestaurants(@RequestParam Integer userId) {
        return restaurantService.recommendRestaurants(userId);
    }
}

